package main

import (
	"fmt"
)

func main() {
	var ch chan int
	ch = make(chan int)
	
	fmt.Println(ch)
	
	s := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
	
	go sum(s[:len(s) / 2], ch)
	go sum(s[len(s) / 2:], ch)
	
	x, y := <-ch, <-ch
	
	fmt.Println(x, y, x+y)
}

func sum(s []int, c chan int) {
	sum := 0
	for _, v := range s {
		sum += v
	}
	
	c <- sum
}